home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 351-375 / disk_351 / pdc / libsrc.lzh / LibSrc / Math / dabs.c < prev    next >
C/C++ Source or Header  |  1990-04-07  |  2KB  |  77 lines

  1. /************************************************************************
  2.  *                                                                      *
  3.  *                              N O T I C E                             *
  4.  *                                                                      *
  5.  *                      Copyright Abandoned, 1987, Fred Fish            *
  6.  *                                                                      *
  7.  *      This previously copyrighted work has been placed into the       *
  8.  *      public domain by the author (Fred Fish) and may be freely used  *
  9.  *      for any purpose, private or commercial.  I would appreciate     *
  10.  *      it, as a courtesy, if this notice is left in all copies and     *
  11.  *      derivative works.  Thank you, and enjoy...                      *
  12.  *                                                                      *
  13.  *      The author makes no warranty of any kind with respect to this   *
  14.  *      product and explicitly disclaims any implied warranties of      *
  15.  *      merchantability or fitness for any particular purpose.          *
  16.  *                                                                      *
  17.  ************************************************************************
  18.  */
  19.  
  20. /*
  21.  *  FUNCTION
  22.  *
  23.  *      dabs,fabs   double precision absolute value
  24.  *
  25.  *  KEY WORDS
  26.  *
  27.  *      dabs
  28.  *      fabs
  29.  *      machine independent routines
  30.  *      math libraries
  31.  *
  32.  *  DESCRIPTION
  33.  *
  34.  *      Returns absolute value of double precision number.
  35.  *
  36.  *      The fabs routine is supplied for compatibility with unix
  37.  *      libraries where for some bizarre reason, the double precision
  38.  *      absolute value routine is called fabs.
  39.  *
  40.  *  USAGE
  41.  *
  42.  *      double dabs (x)
  43.  *      double x;
  44.  *
  45.  *      double fabs (x)
  46.  *      double x;
  47.  * 
  48.  *  PROGRAMMER
  49.  *
  50.  *      Fred Fish
  51.  *
  52.  */
  53.  
  54. #include <stdio.h>
  55. #include "pml.h"
  56.  
  57. static char funcname[] = "dabs";
  58.  
  59. double dabs (x)
  60. double x;
  61. {
  62.     DBUG_ENTER (funcname);
  63.     DBUG_3 ("dabsin", "arg %le", x);
  64.     if (x < 0.0) {
  65.         x = -x;
  66.     }
  67.     DBUG_3 ("dabsout", "result %le", x);
  68.     DBUG_RETURN (x);
  69. }
  70.  
  71.  
  72. double fabs (x)
  73. double x;
  74. {
  75.     return (dabs(x));
  76. }
  77.